/*test function with pointers  
 */
 

struct tree {
	int data;
	struct tree * left;
	struct tree * right;
};
/*@*/
struct tree *  buildTree( struct tree * root,int depth)
{
  int i;
	struct tree * p;
	struct tree * q;
	
	
	i=0;
        
//        print (1111);

	if (depth==0)
	{
	  return root;
	}
	else {
  //        print (2222);
          q= alloc (struct tree);
	  q->left=NULL;
	  q->right=NULL;

    //      print (3333);
          p= alloc (struct tree);
	  p->left=NULL;
	  p->right=NULL;

      //    print (4444);
          q->data=depth;
          p->data=depth;
          
        //  print (5555);
          root->left=buildTree(p,depth-1);

          //print (6666);
          root->right=buildTree(p,depth-1);
          return root;
	}	
}
/*@*/
/*@*/
void printTree(struct tree * root)
{
	if(root!=NULL)
	{
         // print (11111);

          print(root->data);
          
        //  print (22222);

          printTree(root->left);

          printTree(root->right);
          return;
	}
	else
          {
	  return;
	}
}
/*@*/
/*@*/
int main()
{
	struct tree *root ;

      //  print (111);
	
	root = alloc (struct tree) ;
      //  print (222);
	root->data = 5;
	root= buildTree(root,3);
	printTree(root);
	return 0;
}
/*@*/
